package com.kosam.rabbitmqservice.send;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * Created by tgx on 2017/3/7.
 */
@Component
public class Sender {
    @Autowired
    private RabbitTemplate rabbitTemplate;

    public void send(String msg) {
        String context = "hello kosam ";
        System.out.println("Sender : " + context + " "+ new Date());
        this.rabbitTemplate.convertAndSend("hello", context);
    }
}
